import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
//master
public class Main{
    public static void main(String[] args) {
        HashMap<String, Integer> map1 = new HashMap<>();
        map1.put("a",1);
        map1.put("b",2);
        map1.put("c",3);
        map1.put("d",4);
        HashMap<String, Integer> map2 = new HashMap<>();
        map2.put("c",6);
        map2.put("d",8);
        map2.put("e",9);
        map2.put("f",10);
        Iterator<Map.Entry<String, Integer>> iterator = map2.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Integer> entry = iterator.next();
            String key = entry.getKey();
            Integer value = entry.getValue();
            if (map1.get(key) == null){
                map1.put(key,value);
            }
            if (map1.get(key) < value){
                map1.put(key,value);
            }
        }
        System.out.println("map1 = " + map1);
    }
}